#include <drive/disk.h>
#include <drive/ata.h>
#include <asm/asm.h>

struct IDEChannelRegisters channels[2] = {
    {IO_BASE_PRIMARY, CONTROL_BASE_PRIMARY, 0x0, 0x0},
    {IO_BASE_SECONDARY, CONTROL_BASE_SECONDARY, 0x0, 0x0},
};

//
int ata_read_pio_lba48(struct ATADevice *device, u64_t lba48, u32_t count, i8_t *buffer)
{
    int dr = device->drive;
    int ch = device->channel;
    u8_t cmd[]={0x40, 0x50};
    
    lba48=0x0000ffffffffffff&lba48;
    count=count&0xff;
    buffer[0]=0;
    io_in8(channels[ch].base, cmd[dr]);
    return 1;
}